Urthman's MDB Construction Kit.
Understanding MDB Script Files

Quick methods for defining tables for your database
through importing source code snippets or scripts.


General Information. Fixed Length Records and Fillers.
Formatted Data and Using Arrays. Main Document

General Information: The Urthman's MDB Construction Kit was initially designed around building tables from Visual Basic source code snippets and evolved into something a little more sophisticated. The scripts can be little more than a series of Visual Basic variable declarations copied right from your source code and pasted into a text file, or they can also be simple text files containing record layout information.

Basically, the scripting only needs a variable name and data type, the size being optional unless you need to define fixed length fields and records.

Variable Name Data Type Size
TextVar1 String 35
DoubleVar1 Double 8
LongVar1 Long 6

However, the full spectrum of the Visual Basic language variable declarations can be used, with certain mnemonics being ignored.

VB Variable Declarations Meaning or Values
Dim TrueFalse As Boolean True or False
Dim ByteVar As Byte Unsigned 8-bit value
Dim Money As Currency Currency values
Dim Calendar As Date Date and Time values
Dim DoubleVar1 As Double Signed double precision value
Dim IntVar1 As Integer Signed 16-bit value
Dim LongVar As Long Signed 32-bit value
Dim SingleVar As Single Signed single precision value
Dim TextVar1 As String Text or String
VB short-hand data types Meaning or Values
Dim Money@ Currency values
Dim DoubleVar1# Signed double precision value
Dim IntVar1% Signed 16-bit value
Dim LongVar& Signed 32-bit value
Dim SingleVar! Signed single precision value
Dim TextVar1$ Text or String

Other data types that have been added to the standard Visual Basic types for the sake of convenience to other users familiar with other programming languages or who are working with record specifications in the form of text file documents include these:

Alternate Variable Declarations Equivalent Meaning
Dim MemoVar As Memo Memo field (MS Access)
Dim IntVar2 As Int Integer (C/C++ and others)
Dim SingleVar2 As Float Single Precision (C/C++)
Dim TextVar2 As Text Text or String (MS Access)
Dim TextVar3 As Char Text or String (C/C++ and others)

To take this one step further, a section has been provided where custom mnemonic data types can be defined. The two that I use most frequently are:

Alternate Variable Declarations Equivalent Meaning
Dim DateVar2 As YMD Date, formatted YYMMDD, fixed at 6
Dim TimeVar2 As HMS Time, formatted HHNNSS, fixed at 6

Formatted? One of the key functions of this program is for generating import and export code for your Access Database, including comma delimited formats and fixed field and record lengths. These two additions, that I use most frequently, provide a formatting short-hand for the type of tables that I need to create.

Specifying a string length (i.e., Dim StringVar As String *32) provides the program with fixed length field formatting information. Although not directly compatible with Visual Basic mnemonics, the script mechanism in this program also allows this same length specifier for all data types, permitting a fast method for defining fixed length data records.

There are a number for formatting options available for defining how the data looks (or should look) in external ASCII files. Numeric values, for example, might include decimal places with or without a decimal point in the data. Dates and time values might require specific formatting, including Julian dates. All of these functions are available in this program.

Defined Arrays? Array declarations can be used to denote multiple numbered fields with the same base name. Simply declare the variable name as you would any array variable, and the all of the fields are created with the numbering beginning at zero (0). For arrays with up to 9 elements, the numbering uses a single character. For arrays up to 99, the numbering uses 2 characters etc. For the sake of greater flexibility, both the standard parenthesis and square brackets can be used: both (9) and [9] trigger the array. However, like Visual Basic, these array values must immediately follow the variable name.

Fixed Length Records? As noted above, defining the data size in the variable declarations for the importable code used in the creation of a table definition is a quick method for defining fixed field lengths. If all fields have a defined size, then a fixed record length can be defined. This also applies to filler and reserved fields.

Fillers and Reserved Fields? Field names that begin with Filler, Reserved or Unused are not used in the creation of the table, but are incorporated in the import and export file record code module. If you need to define a reserved field in your table, rename it with a functional but harmless name, and it will be used.

Comments? The comments in the code/scripts are converted to descriptions in the database generated by this program. This provides a convenient cross reference when examining the database created by the program and the original script text file.


Contact: John Stanley Enterprises
PO Box 1672
Valrico, FL 33595-1672
URL: http://www.a-znet.com/jse/
Email: urthman@usa.net
  Microsoft, Windows, NT and Visual Basic are registered trademarks of the Microsoft Corporation.